package com.example.demo.abstractfactorypattern;

import com.example.demo.abstractfactorypattern.color.Color;
import com.example.demo.abstractfactorypattern.factory.AbstractFactory;
import com.example.demo.abstractfactorypattern.factory.FactoryProducer;
import com.example.demo.factorypattern.Car;

/**
 * @author :xie
 * Email: 1487471733@qq.com
 * Date: 2018/9/6
 * Time: 18:22
 * Describe:
 */
public class Demo {

    public static void main(String[] args) {

        AbstractFactory factory = FactoryProducer.getFactory("color");

        Color red = factory.getColor("red");

        red.clr();
        AbstractFactory factory1 = FactoryProducer.getFactory("car");

        Car car = factory1.getCar("red");

        Car blue = factory1.getCar("blue");
        car.draw();
        blue.draw();

    }
}

// 抽象工厂模式，就是在工厂模式上面加上一个抽象工厂，

//利用抽象工厂来生成具体的工厂，然后具体的工厂来操作各种产品

